#ifndef _GLOBALS_H_
#define _GLOBALS_H_
/* 	$Id: globals.h,v 1.2 2008/05/09 02:49:49 kzj Exp $	 */

#include <stdio.h>

#define MAXCHILDREN 8

#ifndef BUFSIZE
#define BUFSIZE 8192 /* two page buf is so big */
#endif


#ifndef _TRUE
#define _TRUE 0
#endif

#ifndef DEBUG
#define DEBUG
#endif

#ifndef _FALSE
#define _FALSE 1
#endif

extern FILE *listing;		/* for list the syntax tree and
				 * infomation use print log here */
extern int line_no;		 /* for record the line number */
typedef enum {nothing,but} token_type; /* add later */

typedef enum {_private, _protected, _public} access_type;
typedef enum {stmtk, exprk} tnode_kind;
typedef enum {ifk, whilek , assignk, declarek } stmt_kind;
typedef enum {op_key,
	      const_key,
	      id_key,
	      class_key,
	      union_key,
	      struct_key
} expr_kind;
typedef enum {_void,
	      _defined_type,
	      _class_type,
	      _integer,
	      _boolean,
	      _double
} expr_type;

typedef enum {
	not_template,
	is_template
} template_kind;

typedef struct _tree_node_ {
	struct _tree_node_ *child[MAXCHILDREN];
	struct _tree_node_ *sibling;
	int lineno;
	tnode_kind node_kind;
	template_kind is_template;
	union { stmt_kind stmt; expr_kind expr;} kind;
	union {	token_type op;
		int val;
		char *name; } attr;
	expr_type type; 	/* for type checking of exprs */
	
	struct {
		access_type	_access		;
		unsigned short	_virtual	; /* ture means is
						     * vartual */
		unsigned short  _alone ;          /* true means this
						   * class have no
						   * father class  */
	}class_attr;
} tree_node;
	typedef tree_node *tree ;

#ifdef DEBUG
#define DEBUGOUT2(s,t) {		\
		printf("# DEBUG: ");	\
		printf(s,t);		\
	}
#define DEBUGOUT1(s) {				\
		printf("# DEBUG: ");		\
		printf("%s\n",s);		\
	}
#else
#define DEBUGOUT2(s,t) {}
#define DEBUGOUT1(s) {}
#endif


#endif	/* GLOBALS.h */
